﻿namespace Sidvall.FileSystemManager.UI.Entities
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
    public sealed partial class RenameConfig : global::Sidvall.FileSystemManager.UI.Entities.Core.BusinessBase, global::Sidvall.FileSystemManager.Data.IRenameConfig
    {
        #region Business Members

        #region CaseSensitive

        private bool _CaseSensitive = false;
        partial void OnBeforeCaseSensitivePropertyGet(Sidvall.Business.PropertyEventData<bool> eventData);
        partial void OnBeforeCaseSensitivePropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterCaseSensitivePropertyChanged();
        public bool CaseSensitive
        {
            get
            {
                Sidvall.Business.PropertyEventData<bool> eventData = new Sidvall.Business.PropertyEventData<bool>(_CaseSensitive);
                OnBeforeCaseSensitivePropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _CaseSensitive);
                OnBeforeCaseSensitivePropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("CaseSensitive", eventData.Value, true, true, true);
                    OnAfterCaseSensitivePropertyChanged();
                }
            }
        }

        #endregion
        #region FolderPath

        private string _FolderPath = string.Empty;
        partial void OnBeforeFolderPathPropertyGet(Sidvall.Business.PropertyEventData<string> eventData);
        partial void OnBeforeFolderPathPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterFolderPathPropertyChanged();
        public string FolderPath
        {
            get
            {
                Sidvall.Business.PropertyEventData<string> eventData = new Sidvall.Business.PropertyEventData<string>(_FolderPath);
                OnBeforeFolderPathPropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _FolderPath);
                OnBeforeFolderPathPropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("FolderPath", eventData.Value, true, true, true);
                    OnAfterFolderPathPropertyChanged();
                }
            }
        }

        #endregion
        #region NewName1

        private string _NewName1 = string.Empty;
        partial void OnBeforeNewName1PropertyGet(Sidvall.Business.PropertyEventData<string> eventData);
        partial void OnBeforeNewName1PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterNewName1PropertyChanged();
        public string NewName1
        {
            get
            {
                Sidvall.Business.PropertyEventData<string> eventData = new Sidvall.Business.PropertyEventData<string>(_NewName1);
                OnBeforeNewName1PropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _NewName1);
                OnBeforeNewName1PropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("NewName1", eventData.Value, true, true, true);
                    OnAfterNewName1PropertyChanged();
                }
            }
        }

        #endregion
        #region NewName2

        private string _NewName2 = string.Empty;
        partial void OnBeforeNewName2PropertyGet(Sidvall.Business.PropertyEventData<string> eventData);
        partial void OnBeforeNewName2PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterNewName2PropertyChanged();
        public string NewName2
        {
            get
            {
                Sidvall.Business.PropertyEventData<string> eventData = new Sidvall.Business.PropertyEventData<string>(_NewName2);
                OnBeforeNewName2PropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _NewName2);
                OnBeforeNewName2PropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("NewName2", eventData.Value, true, true, true);
                    OnAfterNewName2PropertyChanged();
                }
            }
        }

        #endregion
        #region NewName3

        private string _NewName3 = string.Empty;
        partial void OnBeforeNewName3PropertyGet(Sidvall.Business.PropertyEventData<string> eventData);
        partial void OnBeforeNewName3PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterNewName3PropertyChanged();
        public string NewName3
        {
            get
            {
                Sidvall.Business.PropertyEventData<string> eventData = new Sidvall.Business.PropertyEventData<string>(_NewName3);
                OnBeforeNewName3PropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _NewName3);
                OnBeforeNewName3PropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("NewName3", eventData.Value, true, true, true);
                    OnAfterNewName3PropertyChanged();
                }
            }
        }

        #endregion
        #region OldName1

        private string _OldName1 = string.Empty;
        partial void OnBeforeOldName1PropertyGet(Sidvall.Business.PropertyEventData<string> eventData);
        partial void OnBeforeOldName1PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterOldName1PropertyChanged();
        public string OldName1
        {
            get
            {
                Sidvall.Business.PropertyEventData<string> eventData = new Sidvall.Business.PropertyEventData<string>(_OldName1);
                OnBeforeOldName1PropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _OldName1);
                OnBeforeOldName1PropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("OldName1", eventData.Value, true, true, true);
                    OnAfterOldName1PropertyChanged();
                }
            }
        }

        #endregion
        #region OldName2

        private string _OldName2 = string.Empty;
        partial void OnBeforeOldName2PropertyGet(Sidvall.Business.PropertyEventData<string> eventData);
        partial void OnBeforeOldName2PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterOldName2PropertyChanged();
        public string OldName2
        {
            get
            {
                Sidvall.Business.PropertyEventData<string> eventData = new Sidvall.Business.PropertyEventData<string>(_OldName2);
                OnBeforeOldName2PropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _OldName2);
                OnBeforeOldName2PropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("OldName2", eventData.Value, true, true, true);
                    OnAfterOldName2PropertyChanged();
                }
            }
        }

        #endregion
        #region OldName3

        private string _OldName3 = string.Empty;
        partial void OnBeforeOldName3PropertyGet(Sidvall.Business.PropertyEventData<string> eventData);
        partial void OnBeforeOldName3PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterOldName3PropertyChanged();
        public string OldName3
        {
            get
            {
                Sidvall.Business.PropertyEventData<string> eventData = new Sidvall.Business.PropertyEventData<string>(_OldName3);
                OnBeforeOldName3PropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _OldName3);
                OnBeforeOldName3PropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("OldName3", eventData.Value, true, true, true);
                    OnAfterOldName3PropertyChanged();
                }
            }
        }

        #endregion
        #region RecursiveFolders

        private bool _RecursiveFolders = false;
        partial void OnBeforeRecursiveFoldersPropertyGet(Sidvall.Business.PropertyEventData<bool> eventData);
        partial void OnBeforeRecursiveFoldersPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterRecursiveFoldersPropertyChanged();
        public bool RecursiveFolders
        {
            get
            {
                Sidvall.Business.PropertyEventData<bool> eventData = new Sidvall.Business.PropertyEventData<bool>(_RecursiveFolders);
                OnBeforeRecursiveFoldersPropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _RecursiveFolders);
                OnBeforeRecursiveFoldersPropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("RecursiveFolders", eventData.Value, true, true, true);
                    OnAfterRecursiveFoldersPropertyChanged();
                }
            }
        }

        #endregion
        #region RenameConfigId

        private System.Nullable<int> _RenameConfigId = null;
        partial void OnBeforeRenameConfigIdPropertyGet(Sidvall.Business.PropertyEventData<System.Nullable<int>> eventData);
        partial void OnBeforeRenameConfigIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<int>> eventData);
        partial void OnAfterRenameConfigIdPropertyChanged();
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        public System.Nullable<int> RenameConfigId
        {
            get
            {
                Sidvall.Business.PropertyEventData<System.Nullable<int>> eventData = new Sidvall.Business.PropertyEventData<System.Nullable<int>>(_RenameConfigId);
                OnBeforeRenameConfigIdPropertyGet(eventData);
                return eventData.Value;
            }
            internal set
            {
                Sidvall.Business.PropertyChangeEventData<System.Nullable<int>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<int>>(value, _RenameConfigId);
                OnBeforeRenameConfigIdPropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("RenameConfigId", eventData.Value, true, true, true);
                    OnAfterRenameConfigIdPropertyChanged();
                }
            }
        }

        #endregion
        #region RenameFiles

        private bool _RenameFiles = false;
        partial void OnBeforeRenameFilesPropertyGet(Sidvall.Business.PropertyEventData<bool> eventData);
        partial void OnBeforeRenameFilesPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterRenameFilesPropertyChanged();
        public bool RenameFiles
        {
            get
            {
                Sidvall.Business.PropertyEventData<bool> eventData = new Sidvall.Business.PropertyEventData<bool>(_RenameFiles);
                OnBeforeRenameFilesPropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _RenameFiles);
                OnBeforeRenameFilesPropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("RenameFiles", eventData.Value, true, true, true);
                    OnAfterRenameFilesPropertyChanged();
                }
            }
        }

        #endregion
        #region RenameFolders

        private bool _RenameFolders = false;
        partial void OnBeforeRenameFoldersPropertyGet(Sidvall.Business.PropertyEventData<bool> eventData);
        partial void OnBeforeRenameFoldersPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterRenameFoldersPropertyChanged();
        public bool RenameFolders
        {
            get
            {
                Sidvall.Business.PropertyEventData<bool> eventData = new Sidvall.Business.PropertyEventData<bool>(_RenameFolders);
                OnBeforeRenameFoldersPropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _RenameFolders);
                OnBeforeRenameFoldersPropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("RenameFolders", eventData.Value, true, true, true);
                    OnAfterRenameFoldersPropertyChanged();
                }
            }
        }

        #endregion
        #region SearchPatterns

        private string _SearchPatterns = string.Empty;
        partial void OnBeforeSearchPatternsPropertyGet(Sidvall.Business.PropertyEventData<string> eventData);
        partial void OnBeforeSearchPatternsPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterSearchPatternsPropertyChanged();
        public string SearchPatterns
        {
            get
            {
                Sidvall.Business.PropertyEventData<string> eventData = new Sidvall.Business.PropertyEventData<string>(_SearchPatterns);
                OnBeforeSearchPatternsPropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _SearchPatterns);
                OnBeforeSearchPatternsPropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("SearchPatterns", eventData.Value, true, true, true);
                    OnAfterSearchPatternsPropertyChanged();
                }
            }
        }

        #endregion
        #region UpdateFileContents

        private bool _UpdateFileContents = false;
        partial void OnBeforeUpdateFileContentsPropertyGet(Sidvall.Business.PropertyEventData<bool> eventData);
        partial void OnBeforeUpdateFileContentsPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterUpdateFileContentsPropertyChanged();
        public bool UpdateFileContents
        {
            get
            {
                Sidvall.Business.PropertyEventData<bool> eventData = new Sidvall.Business.PropertyEventData<bool>(_UpdateFileContents);
                OnBeforeUpdateFileContentsPropertyGet(eventData);
                return eventData.Value;
            }
            set
            {
                Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _UpdateFileContents);
                OnBeforeUpdateFileContentsPropertyChanged(eventData);
                if (!eventData.Cancel)
                {
                    LoadInstanceField("UpdateFileContents", eventData.Value, true, true, true);
                    OnAfterUpdateFileContentsPropertyChanged();
                }
            }
        }

        #endregion
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.FileSystemManager.UI.SystemContext.Current.EntityFacade.RenameConfigManager.GetKey(this);
            }
        }

        #endregion
        #region LoadInstanceField

        public void LoadInstanceField(string fieldName, object value, bool cascade, bool raisePropertyChanged, bool updateState)
        {
            global::Sidvall.FileSystemManager.UI.SystemContext.Current.EntityFacade.RenameConfigManager.LoadInstanceField(this, fieldName, value, cascade, raisePropertyChanged, updateState);
        }

        #endregion
        #region AcceptChanges

        public void AcceptChanges()
        {
            global::Sidvall.FileSystemManager.UI.SystemContext.Current.EntityFacade.RenameConfigManager.AcceptChanges(this);
        }

        #endregion
        #region Copy

        public RenameConfig Copy()
        {
            return Copy(null);
        }
        partial void OnAfterCopy(RenameConfig destination, Sidvall.Data.CopySettings settings);
        public RenameConfig Copy(Sidvall.Data.CopySettings settings)
        {
            var item = global::Sidvall.FileSystemManager.UI.SystemContext.Current.EntityFacade.RenameConfigManager.Copy(this, settings);
            OnAfterCopy(item, settings);
            return item;
        }

        #endregion
        #region Import

        public void Import(global::Sidvall.FileSystemManager.Data.IRenameConfig item)
        {
            Import(item, null);
        }
        partial void OnAfterImport(global::Sidvall.FileSystemManager.Data.IRenameConfig source, Sidvall.Data.CopySettings settings);
        public void Import(global::Sidvall.FileSystemManager.Data.IRenameConfig item, Sidvall.Data.CopySettings settings)
        {
            global::Sidvall.FileSystemManager.UI.SystemContext.Current.EntityFacade.RenameConfigManager.Import(this, item, settings);
            OnAfterImport(item, settings);
        }

        #endregion
        #region ValidateAsync

        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync()
        {
            return await ValidateAsync((Sidvall.Data.ValidationSettings)null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync(Sidvall.Data.ValidationSettings settings)
        {
            var context = new Sidvall.Business.ValidationContext(settings);
            await global::Sidvall.FileSystemManager.UI.SystemContext.Current.EntityFacade.RenameConfigManager.ValidateAsync(this, context).ConfigureAwait(false);
            await ValidateAsync(context).ConfigureAwait(false);
            return context.AllBusinessRules;
        }
        partial void OnAfterValidate(Sidvall.Data.BusinessRuleCollection itemBusinessRules, Sidvall.Business.ValidationContext context);
        public async System.Threading.Tasks.Task ValidateAsync(Sidvall.Business.ValidationContext context)
        {
            var itemBusinessRules = new Sidvall.Data.BusinessRuleCollection();
            OnAfterValidate(itemBusinessRules, context);
            await context.TaskContext.DoTaskAsync().ConfigureAwait(false);
            context.AllBusinessRules.AddRange(context.Settings.IncludeNotBrokenRules, itemBusinessRules);
            var businessRulesProvider = this as Sidvall.Data.IBusinessRulesProvider;
            if (businessRulesProvider != null)
                businessRulesProvider.BusinessRules.AddRange(context.Settings.IncludeNotBrokenRules, itemBusinessRules);
        }

        #endregion
        #region Initialize

        public void Initialize()
        {
            global::Sidvall.FileSystemManager.UI.SystemContext.Current.EntityFacade.RenameConfigManager.Initialize(this);
        }
        public void Initialize(Sidvall.Data.InitializeSettings settings)
        {
            global::Sidvall.FileSystemManager.UI.SystemContext.Current.EntityFacade.RenameConfigManager.Initialize(this, settings);
        }

        #endregion
        
        #region IRenameConfig Members

        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.CaseSensitive
        {
            get
            {
                return this._CaseSensitive;
            }
            set
            {
                this._CaseSensitive = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.FolderPath
        {
            get
            {
                return this._FolderPath;
            }
            set
            {
                this._FolderPath = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.NewName1
        {
            get
            {
                return this._NewName1;
            }
            set
            {
                this._NewName1 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.NewName2
        {
            get
            {
                return this._NewName2;
            }
            set
            {
                this._NewName2 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.NewName3
        {
            get
            {
                return this._NewName3;
            }
            set
            {
                this._NewName3 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.OldName1
        {
            get
            {
                return this._OldName1;
            }
            set
            {
                this._OldName1 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.OldName2
        {
            get
            {
                return this._OldName2;
            }
            set
            {
                this._OldName2 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.OldName3
        {
            get
            {
                return this._OldName3;
            }
            set
            {
                this._OldName3 = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.RecursiveFolders
        {
            get
            {
                return this._RecursiveFolders;
            }
            set
            {
                this._RecursiveFolders = value;
            }
        }
        System.Nullable<int> global::Sidvall.FileSystemManager.Data.IRenameConfig.RenameConfigId
        {
            get
            {
                return this._RenameConfigId;
            }
            set
            {
                this._RenameConfigId = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.RenameFiles
        {
            get
            {
                return this._RenameFiles;
            }
            set
            {
                this._RenameFiles = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.RenameFolders
        {
            get
            {
                return this._RenameFolders;
            }
            set
            {
                this._RenameFolders = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.SearchPatterns
        {
            get
            {
                return this._SearchPatterns;
            }
            set
            {
                this._SearchPatterns = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.UpdateFileContents
        {
            get
            {
                return this._UpdateFileContents;
            }
            set
            {
                this._UpdateFileContents = value;
            }
        }

        #endregion

        #endregion
        #region Constructors

        public RenameConfig()
        {
        }

        public RenameConfig(Sidvall.Data.DataRowState? dataRowState)
            : base(dataRowState)
        {
        }

        #endregion
    }
}